package com.huakang.service.impl;

import com.huakang.entity.Medbuy;
import com.huakang.mapper.MedbuyMapper;
import com.huakang.service.MedbuyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class MedbuyServiceImpl implements MedbuyService {
    @Autowired
    private MedbuyMapper medbuyMapper;


    @Override
    public List<Medbuy> findAll() {
        return medbuyMapper.selectByExample(null);
    }

    @Override
    public boolean medbuyadd(Medbuy medbuy) {
        medbuy.setBuytime(new Date()); //入库时时间为当前时间
        return medbuyMapper.insert(medbuy)>0?true:false;
    }

    @Override
    public List<Medbuy> buySearch(Medbuy medbuy) {
        return medbuyMapper.buySearch(medbuy);
    }
}
